﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using University.Workshop.Presenters.Square.Search;

namespace University.Workshop.Presentation.Square
{
    /// <summary>
    /// Interaction logic for SearchSquare.xaml
    /// </summary>
    public partial class SearchSquare : Page,ISearchSquareView
    {
        PresenterSearchSquare pSearchSquare;
        public SearchSquare()
        {
            InitializeComponent();
            pSearchSquare = new PresenterSearchSquare(this);
            App.Current.MainWindow.Title = "UIBuscarManzano";
        }

        private void NewSquareBtnClick(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(new Register.RegisterSquare());
        }

        private void SearchSquareBtnClick(object sender, RoutedEventArgs e)
        {
            pSearchSquare.SearchKardex();
        }

        private void ShowSquareBtnClick(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(
                new Presentation.Square.Show.PageShowView((Model.Square)SquareFindeddtgv.SelectedItem));
        }

        private void ModifySquareBtnClick(object sender, RoutedEventArgs e)
        {
            this.NavigationService.Navigate(
                new Presentation.Square.Modify.ModifySquareView((Model.Square)SquareFindeddtgv.SelectedItem));

        }

        public string SquareIdRelative
        {
            get
            {
                return PersonNameRelativeTxbx.Text;
            }
            set
            {
                PersonNameRelativeTxbx.Text = value;
            }
        }

        public ICollection<Model.Square> SquareFinded
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                SquareFindeddtgv.ItemsSource = null;
                SquareFindeddtgv.ItemsSource = value;
            }
        }

        public void NotifyErrorMessage(string p)
        {
            MessageBox.Show(Application.Current.MainWindow, p, "Error!!!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.RightAlign);

        }

        private void DisableSquareBtnClick(object sender, RoutedEventArgs e)
        {
            pSearchSquare.DisableSquare();
        }

        private void EnableSquareBtnClick(object sender, RoutedEventArgs e)
        {
            pSearchSquare.EnableSquare();
        }


        public void NotifySystemMessage(string p)
        {
            MessageBox.Show(Application.Current.MainWindow, p, "Atencion!!!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }

        public string StateSquare
        {
            get
            {
                return SquareStatedd.SelectionBoxItem.ToString();
            }
        }


        public Model.Square SquareSeleted
        {
            get { return (Model.Square) SquareFindeddtgv.SelectedItem; }
        }
    }
}
